import {SingleInstance} from './singleinstance'

import * as path from 'path';
import * as fs from 'fs';

async function run(){
    const driver = SingleInstance.create_driver();
    const downloads = path.join(__dirname,'../downloads');
    if (! fs.existsSync(downloads)){
        fs.mkdirSync(downloads)
    }
    await driver.setDownloadPath(downloads);

    await driver.get('https://www.wandoujia.com/apps/6629980');
    const checkbox = await driver.findElement({css:'[id="checkBox"]'})
    await checkbox.click();

    const link = await driver.findElement({css:'[data-bd-track="detail-common_download_main"]'});
    await link.click();

}

run();